using FluentMigrator;
using FluentMigrator.Postgres;

namespace Crux.Core.Dapper.Test;
[Migration(202406242038)]
public class TestMigration : Migration
{
    public override void Down()
    {
    }

    public override void Up()
    {
        Create.Table("test_model")
            .WithColumn("id").AsInt64().PrimaryKey().Identity().WithColumnDescription("主键")
            .WithColumn("password").AsString(32).NotNullable()
            .WithColumn("amount").AsDecimal().NotNullable()
            .WithColumn("win_range").AsInt64().NotNullable()
            .WithColumn("effective").AsBoolean().NotNullable()
            .WithColumn("modifyd_at").AsDateTime2().NotNullable();
        Create.Index("IX_test_model").OnTable("test_model")
             .OnColumn("password").Ascending()
             .OnColumn("amount").Ascending().WithOptions().Include("effective").NonClustered();
        Create.Table("test_soft_delete_model")
            .WithColumn("id").AsInt64().PrimaryKey().Identity()
            .WithColumn("user_name").AsString(32).NotNullable()
            .WithColumn("modifyd_at").AsDateTime2().NotNullable()
            .WithColumn("status").AsInt32().NotNullable();
        Create.Table("notices")
            .WithColumn("id").AsGuid().PrimaryKey();
    }
}